package top.kaoshanji.p1ch03c;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import top.kaoshanji.p1ch03b.service.TestService;

/**
 * @author kaoshanji
 * ^_^
 * create time 2025/5/19 15:06
 */
@Slf4j
@Configuration
public class CommandLineRunnerContext {

    @Value("${debug}")
    private boolean debug;

    @Bean
    public CommandLineRunner commandLineRunner(TestService testService) {
        return (args ) -> {
            log.info("...debug mode: {}", debug);
            log.info(testService.getServiceName());
        };
    }

}
